home *** CD-ROM | disk | FTP | other *** search
/ The Arsenal Files 8 / The Arsenal Files Collection #8 (Arsenal Computer) (1996).ISO / win_nt95 / cm95-10.zip / HOLLYVID.TS < prev    next >
Text File  |  1996-10-29  |  6KB  |  210 lines

  1. ;****************************************************************************
  2. ; ClockMan95 Automation Assistant support file - TAPCIS script
  3. ; (c) 1995 Graphical Dynamics, Inc. The "Common helper functions" are placed
  4. ; in the public domain; otherwise permission is granted to use/modify this
  5. ; script file as long as it's not for resale.
  6. ;
  7. ; Written by: Jennifer Palonus
  8. ;
  9. ; Date    Who   Major changes
  10. ;-------  ---   -------------------------------------------------------------
  11. ;22nov95  jlp   Created.
  12. ;22nov95
  13. ;****************************************************************************
  14.  
  15. [*About this script*]
  16. Gets the latest "Hollywood Hotline's New On Home Video".
  17.  
  18. [*Script Setup*]
  19. Title=Hollywood Hotline's New On Home Video
  20.  
  21. ;****************************************************************************
  22. ; Main processing section.
  23. ;****************************************************************************
  24.  
  25. [*MenuItems*]
  26. text=New On Home Video
  27.  
  28.  
  29. [Begin]
  30.     set @Timeout# 120
  31.     let ServiceName$    = "CIS:NMM-1"
  32.     let ServiceHasHdr    = @FALSE
  33.     let SubjectLine$    = "Hollywood Hotline's New On Home Video"
  34.     let Prompt$            = "^J!"
  35.     gosub "GoService"
  36.     if (OK = @FALSE) fail
  37.  
  38.     ForEach in MenuItems[] gosub "HandleMenu"
  39.     if (HMTFound = @FALSE) end
  40.  
  41.     gosub "CaptureMsg"
  42.     end
  43.  
  44.  
  45. ;****************************************************************************
  46. ; Common helper functions. (These are placed in the "public domain" by GDI.)
  47. ;****************************************************************************
  48. ; [GoService]
  49. ;
  50. ; Carries out a GO command & passes over the introductory text (if any).
  51. ; When this returns, you're ready to capture or parse the service's top menu.
  52. ;
  53. ; ServiceName$        The CIS service you want to GO to.
  54. ; ServiceHasHdr        Does this service have an intro paragraph ending with a
  55. ;                    "MORE !" prompt?
  56. ;****************************************************************************
  57. [GoService]
  58.     let OK = @TRUE
  59.     send "GO " ServiceName$
  60.  
  61.     if (ServiceHasHdr = @FALSE) return
  62.     let Prompt$ = "^JMORE !"         
  63.     gosub "WaitForPrompt"
  64.     send ""
  65.     return
  66.  
  67.     
  68. ;****************************************************************************
  69. ; [HandleMenu]
  70. ;
  71. ; Traverses the tree of menus until you're ready to capture a particular
  72. ; article. To call this function, declare an array section (ex.: [*Menus*])
  73. ; with menu item text and/or item numbers to look for, in either of these forms:
  74. ;     text=<text in menu item>
  75. ;     item=<menu item's number>
  76. ;     
  77. ; Then, call this function in a ForEach stmt: ForEach in Menus[] gosub "HandleMenu"
  78. ;
  79. ; SubjectLine$        The generated mail message's subject line.
  80. ; Prompt$            The prompt that ends the article. Usu. "^J!".
  81. ;
  82. ; Upon return, OK is @TRUE or @FALSE depending on whether any matching items
  83. ; were found. If @TRUE then you're ready to capture the selected article or
  84. ; parse the submenu.
  85. ;****************************************************************************
  86. [HandleMenu]
  87.     let HMTFound = @FALSE
  88.     ;Dispatch to HMText or HMItem, depending on how to choose menu item (by
  89.     ;"Text" or menu "Item" #)...
  90.     goto "HM" @arrItem$
  91.     ;else bad menu cmd...
  92.          Echo "Unrecognized menu item search type '" @arrItem$ "' in [HandleMenu]"
  93.         fail
  94.  
  95. [HMText]
  96.     let HMSearchText$ = @arrValue$
  97.  
  98. ;1 or more menu sections. If >1, they're separated by "MORE !" prompts...
  99. [HMTLoop]
  100.     waitlist
  101.         1 = "^JMORE !"
  102.         2 = "^J!"
  103.     endlist
  104.     DoWaitMenu TheMenuLines[]
  105.     if (@waitMatch# = 0) goto "HMTNoMatchTimeout"
  106.  
  107.     ForEach in TheMenuLines[] gosub "HMTSelectItem"
  108.     if (HMTFound = @TRUE) return
  109.  
  110. [HMTNoMatch]
  111.     if (@waitMatch# = 1) goto "HMTNoMatchMore"
  112.     if (@waitMatch# = 2) goto "HMTNoMatchEOM"
  113.  
  114. [HMTNoMatchTimeout]
  115.     Echo "Timed out waiting for full menu"
  116.     fail
  117.  
  118. [HMTNoMatchMore]
  119.     send ""
  120.     goto "HMTLoop"
  121.  
  122. [HMTNoMatchEOM]
  123.     return
  124.  
  125.  
  126. [HMTSelectItem]
  127.     if (HMTFound = @TRUE) return
  128.  
  129.     if (@strstr (@arrValue$, HMSearchText$) = @FALSE) return
  130.     let HMTFound = @TRUE
  131.     Echo "We found '" HMSearchText$ "': #" @arrItem$ " = '" @arrValue$ "'!"
  132.     
  133.     send @arrItem$
  134.     return
  135.  
  136.  
  137. [HMItem]
  138.     let HMTFound = @TRUE
  139.     let Prompt$ = ""
  140.     gosub "WaitForPrompt"
  141.  
  142.     Echo "Selecting item #" @arrValue$
  143.     send @arrValue$
  144.     return
  145.  
  146.     
  147. ;****************************************************************************
  148. ; [CaptureMsg]
  149. ;
  150. ; Assuming CIS is about to send us the text that we want to place into a mail
  151. ; message, this routine captures the text 'till we get a <CR> & ! prompt.
  152. ;
  153. ; SubjectLine$        The custom subject line if different than the default.
  154. ; Prompt$            The prompt that ends the article. Usu. "^J!".
  155. ;****************************************************************************
  156. [CaptureMsg]
  157.     if (@capName$ = "") let @capName$ = @pathMsg$ @svcName$ '.MSG'
  158.     let @hdrSub$ = SubjectLine$
  159.     Echo "Capturing article to " @capName$
  160.     CapHeader
  161.  
  162.     let OK = @TRUE
  163.  
  164.     let Prompt$ = "^J!"
  165.     gosub "WaitForPrompt"
  166.     CapClose
  167.  
  168.     let SubjectLine$ = ""
  169.     return
  170.  
  171.  
  172. ;****************************************************************************
  173. ; [WaitForPrompt]
  174. ;
  175. ; Wait till the end of a menu or opening text. This routine handles menus
  176. ; split up into multiple chunks, each of which end in "MORE !" prompts.
  177. ; If you DO want to wait for "MORE !", then set Prompt$ to it.
  178. ;
  179. ; Prompt$            The prompt you're waiting for. Usu. "^J!".
  180. ;****************************************************************************
  181. [WaitForPrompt]
  182.     let OK = @TRUE
  183.     if (Prompt$ = "") let Prompt$ = "^J!"
  184.  
  185. [WFPLoop]
  186.     waitlist
  187.         1 = Prompt$
  188.         2 = "^JMORE !"
  189.         3 = "^J!"
  190.     endlist
  191.     DoWaitMenu TheMenuLines[]
  192.     if (@waitMatch# = 1) return
  193.     if (@waitMatch# = 2) goto "WFPMore"
  194.     if (@waitMatch# = 3) return
  195.  
  196.     ; else...
  197.     let OK = @FALSE
  198.     Echo "...timed out waiting for a prompt"
  199.     return
  200.  
  201. [WFPMore]
  202.     Send ""
  203.     goto "WFPLoop"
  204.  
  205.  
  206. ;****************************************************************************
  207. [HandleErrors]
  208.     fail
  209.  
  210.